#pragma once

#include <cstddef>
#include <cmath>

namespace mdtx::online::indicator::detail
{
    inline double coefs_sd(ptrdiff_t n)
    {
        return std::sqrt(double(n) / (n - 1));
    }

    inline double coefs_sk(ptrdiff_t n)
    {
        return std::sqrt(n * (n - 1)) / (n - 2);
    }

    inline double coefs_ku(ptrdiff_t n)
    {
        return double(n - 1) / ((n - 2) * (n - 3));
    }

    inline double ses_G1(ptrdiff_t n)
    {
        double numerator = 6 * n * (n - 1);
        return std::sqrt(numerator / ((n - 2) * (n + 1) * (n + 3)));
    }

    inline double sek_G2(ptrdiff_t n)
    {
        double ses = ses_G1(n);
        return 2 * ses * std::sqrt(double(n * n - 1) / ((n - 3) * (n + 5)));
    }
}
